<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
     *{ padding: 0; margin: 0; list-style-type: none;}
     .cont{ width: 800px; height: 800px; margin: 0 auto; background: #000; position: relative; overflow: hidden;}
     .cont:hover ul{ animation-play-state: paused; }
     .cont ul{ width: 100%; height: auto; display: flex; flex-direction: column; padding: 50px; box-sizing: border-box; transition: all 1s; left: 0; top: 0; position: absolute;}
     .cont ul li{ width: 100%; height:50px; color: #fff; background-color: red; margin-bottom: 20px; padding: 15px;}
     .actiove{ animation: scrolls 10s linear;}
     /* @keyframes scrolls {
                0%{
                    transform: translateY(0);
                }
                100%{
                    transform: translateY(-100%);
                }
     } */
</style>
<body>
    <div class="cont">
         <ul class="ul1">
            <li>滚动文字列表</li>
            <li>滚动文字列表</li>
            <li>滚动文字列表</li>
            <li>滚动文字列表</li>
            <li>滚动文字列表</li>
            <li>滚动文字列表</li>
         </ul>
    </div>
    <script>
        let cont = document.querySelector('.cont');
        let ul1 = document.querySelector('.ul1');
        ul1.innerHTML += ul1.innerHTML;
        let speed = 55;
        function move(){
            console.log(ul1.offsetTop,-ul1.offsetHeight/2);
                if(ul1.offsetTop < -(ul1.offsetHeight - cont.offsetHeight)){
                    ul1.offsetTop = 0 + 'px';
                    ul1.style.top = 0 + 'px';
                }
                 //获取ul1的高度
                ul1.style.top = (ul1.offsetTop - speed) + 'px';
        }
        let timer = setInterval(move,300);
    </script>
</body>
</html>